import { postAction } from "@/command/netTool";
import { useDetail } from "@/hooks";
import { useRouter } from "vue-router";

export const useRequest = () => {
  const router = useRouter();
  const confirm = (params: any) => {
    delete params.workTime;
    postAction(
      "/api/H5/service/helpWork/heavy/saveInfo",
      { ...params },
      { isResolve: true }
    ).then((e) => {
      // showSuccessToast(e.msg)
      router.push("/sendRecords");
    });
  };
  const [productList] = useDetail("/api/H5/util/getProductLevel", []);
  const [workList] = useDetail(
    "/api/H5/util/getDictType?dictType=work_type",
    []
  );
  return {
    confirm,
    productList,
    workList,
  };
};
